import request from '@/config/axios'

export interface CouponCodeV2VO {
  id: number
  label: string
  code: string
  rule: string
  codeCount: number
  clickCount: number
  opening: byte
}

// 查询券码列表
export const getCouponCodeV2Page = async (params) => {
  return await request.get({ url: `/bank/coupon-code-v2/page`, params })
}

// 查询券码详情
export const getCouponCodeV2 = async (id: number) => {
  return await request.get({ url: `/bank/coupon-code-v2/get?id=` + id })
}

// 新增券码
export const createCouponCodeV2 = async (data: CouponCodeV2VO) => {
  return await request.post({ url: `/bank/coupon-code-v2/create`, data })
}

// 修改券码
export const updateCouponCodeV2 = async (data: CouponCodeV2VO) => {
  return await request.put({ url: `/bank/coupon-code-v2/update`, data })
}

// 删除券码
export const deleteCouponCodeV2 = async (id: number) => {
  return await request.delete({ url: `/bank/coupon-code-v2/delete?id=` + id })
}

// 导出券码 Excel
export const exportCouponCodeV2 = async (params) => {
  return await request.download({ url: `/bank/coupon-code-v2/export-excel`, params })
}
